package io;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @Author Justin Parker
 * @Date 2024/7/16 0016 11:40
 * @Version 1.0
 */
public class FileCopyDemo02 {
    public static void main(String[] args) throws IOException {

        FileInputStream fis = new FileInputStream("a1.jpg");
        FileOutputStream fos = new FileOutputStream("a2.jpg");

        byte[] data = new byte[1024];
        int len = 0;
        while ( (len=fis.read(data))!=-1) {
            fos.write(data, 0, len);
        }
        fis.close();
        fos.close();
        System.out.println("复制成功");
    }
}
